import Router from '_router/router'
import { returnUrlToLinea } from "_commonFn/url.js"

export function toLoginPage({
    url = window.location.href.split('#')[0]
}) {
    console.log('url', url)
    if (process.env.IS_LOCAL) {
        Router.push({
            name: 'Login',
            path: `/Login`,
            query: {
                to: encodeURIComponent(returnUrlToLinea(url))
            }
        })
    } else {
        const html = '?u=' + encodeURIComponent(returnUrlToLinea(url))
        console.log('html', html)
        window.location.href = '../LoginChose.html' + html
    }
}

// 根据vue 路由获取当前URL
export const getRouterUrl = (to) => {
    console.log('to', to)
    return `${window.location.origin}/app${to.fullPath}`
}